package net.zoneland.knowledge.service.impl;

import java.time.LocalDateTime;
import java.util.UUID;
import net.zoneland.knowledge.dao.LoginLogMapper;
import net.zoneland.knowledge.model.LoginLog;
import net.zoneland.knowledge.service.LoginLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 登录日志服务.
 *
 * @author: bcc
 * 2021/6/17
 */
@Service
public class LoginLogServiceImpl implements LoginLogService {

    /**
     * 登录日志数据接口.
     */
    @Autowired
    private LoginLogMapper loginLogMapper;

    /**
     * 构建并保存日志信息.
     * @param loginLog 日志信息.
     */
    @Override
    public void save(final LoginLog loginLog) {
        loginLog.setId(UUID.randomUUID().toString());
        loginLog.setLoginTime(LocalDateTime.now());
        loginLogMapper.insert(loginLog);
    }
}
